# Contributor: Michał Polański <michal@polanski.me>
# Maintainer:
pkgname=pegtl
_pkgname=PEGTL
pkgver=2.8.3
pkgrel=1
pkgdesc="Parsing Expression Grammar Template Library"
url="https://github.com/taocpp/PEGTL"
license="MIT"
arch="noarch"
makedepends="cmake"
subpackages="$pkgname-doc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/taocpp/PEGTL/archive/$pkgver.tar.gz
	ignore-type-limits-error.patch"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DPEGTL_INSTALL_DOC_DIR=share/doc/$pkgname \
		-DPEGTL_INSTALL_CMAKE_DIR=lib/cmake/$pkgname \
		-DPEGTL_BUILD_TESTS=ON \
		-DPEGTL_BUILD_EXAMPLES=OFF
	cmake --build build
}

check() {
	cd build
	ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="9f7644b86741dfe61716bbc43b2ea0a02cfc21eaf229c47cc71a49e2f08bf2c1ff37d2b2242a1bcf518b1893be6b82c27b0e9010a1b47ef8df87ffd90d280f71  PEGTL-2.8.3.tar.gz
84676550e7b9e3ccb193cbe37843c6c4a5e9164ea1146d8e1cb9301b567dff255271b9ffcfacc60988bb887b13a63ba4e1b0919162da11f91724e8056671b42e  ignore-type-limits-error.patch"
